package com.faeple.statistics.service;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.faeple.statistics.dao.PostStatsDao;
import com.faeple.user.entity.UserDto;

@Service
public class PostStatsServiceImpl implements PostStatsService {

	@Autowired
	private PostStatsDao dao;
	
	@Override
	public void addStats(String postIdx, String owner_idx, UserDto userDto) {
		HashMap<String, String> param = new HashMap<>();
		param.put("post_idx", postIdx);
		param.put("member_idx", userDto.getIdx());
		param.put("owner_idx", owner_idx);
		param.put("gender", userDto.getGender());
		param.put("age", String.valueOf(userDto.getAge()));
		param.put("country", userDto.getCountry());
		param.put("location", userDto.getLocation());

		dao.addStats(param);
	}

}
